using System.Collections.Generic;
using Tools.Domain.Specifications;
using Webshop20.Domain.Catalog.Core.Products.Filter.InputContracts;
using Webshop20.Domain.Catalog.Specifications;
using Webshop20.Domain.Shared.Products.Core;

namespace Webshop20.Domain.Catalog.Core.Products.Filter.Implementations
{
    public class ProductsByMinimumPriceSpecificationFilter : ISpecificationFilter<Product>
    {
        public void AddSpecificationTo<S>(ref IList<ISpecification<Product>> specifications, S data)
        {
            var minimumPrice = data as IMinimumPrice;
            if(minimumPrice.MinimumPriceValue != null)
                specifications.Add(new MinimumPriceSpecification(minimumPrice.MinimumPriceValue));
        }
    }
}